//


import UIKit
//import SwiftyJSON


class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        self.view .addSubview(self.tempTableView)
    }
    //tableview
    lazy var tempTableView :UITableView = {
        let tableView = UITableView (frame: self.view.bounds, style:.plain)
        tableView.delegate = self
        tableView.dataSource = self
        tableView.rowHeight = 60
        tableView.register(UITableViewCell.classForCoder(), forCellReuseIdentifier: "cell")
        tableView.tableFooterView = UIView()
        
        return tableView
    }()
    
    lazy var names : [String] = {
        let names = ["why","lmj","lpf"]
        
        print("-----------")
        
        return names;
    }()

    func getData()  {
        
        WP_HttpNetWork.netWork.requestWith(url: "", httpMethod: 1, params: Dictionary(), success: { (AnyObject) in
//            let jsonDict = JSON(AnyObject)
//            print("返回结果：\(jsonDict)")
//
//            if  jsonDict["c"].intValue == 0 {
//                let model = UserModel.init(fromJson: jsonDict["d"])
//                UserDefaults.standard.set(model.accessToken, forKey: "token")
//                print("返回结果：\(model)")
//            }
            
        }) { (AnyObject) in
            
        }
    }
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}

extension ViewController:UITableViewDelegate,UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 2
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
        
        cell.textLabel?.text = "jlsd"
        cell.detailTextLabel?.text = "ddddd"
        cell.accessoryType = .disclosureIndicator
        
        return cell;
    }
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        tableView .deselectRow(at: indexPath, animated: true)
        print("点击了\(indexPath.row)")
    }
    
}
